﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasyBuildingCMS.BLL.BaseEntity;

namespace EasyBuildingCMS.BLL.CoreEngine
{
    public partial class Page : IBaseEntity
    {
        public bool Published
        {
            get { return (this.Approved && this.PublishDate <= DateTime.Now && this.ExpireDate > DateTime.Now); }
        }

 
        /*
        partial void OnCreatedByChanging(string value)
        {
            if (string.IsNullOrEmpty(value) == false)
            {
                throw new ArgumentException("Cannot change the CreatedBy property once it has been set.");
            }
        }

        partial void OnCreatedDateChanging(Nullable<global::System.DateTime> value)
        {
            if (DateTime.MinValue == this.CreatedDate && value <= DateTime.MinValue)
            {
                throw new ArgumentException("The Created Date cannot be empty.");
            }
            if (this.CreatedDate!=null)
            {
                throw new ArgumentException("Cannot change the CreatedDate property once it has been set.");
            }
        }
         * */

        public bool IsValid
        {
            get
            {
                if (string.IsNullOrEmpty(this.PageNavigationText) == false && this.PublishDate < this.ExpireDate)
                {
                    return true;
                }
                return false;
            }
        }      
    }
}
